It would probably help to review Articles #4 and #5.  You are going to need some code running in the ADAU1701 to do input selection, so you will need to work with SigmaStudio to generate that code.  Then you will need to look at the SigmaStudio compiler output to find out which I2C address is used for the input selector cell.  Ive got some PC tools to automatically parse the compiler output and that generates a cell map so the Arduino code can reference the cells symbolically, but the details for using those tools are in Article #13, which isnt written yet.  Article #13 is coming, but its not real high on my to-do list right now.

But once you know the address of the selector cell, you just write the data using the I2C routines that are attached.  The ADAU1701 uses 16-bit subaddresses, so the standard Wire library wont work with the ADAU1701.  However, the routines in the attached sketch will do the job.

Setting up the Control Registers in the ADAU1701 is easyjust set up the variables and then call the I2C functions in that sketch.  For example, here is the code I am using to set up the ADAU1701 for analog and serial input, with one serial output:

void Load_registers() {
  //DAC setup.  Address 0827; initialize DACs = 01
  Parameter_1_MSB = 8;  //subaddress MSB
  Parameter_1 = 0x27;   //subaddress LSB = DAC Setup
  Parameter_2 = 2;      //length
  Cmd_Data[0] = 0;      //Data MSB = 0
  Cmd_Data[1] = 1;      //Data LSB = 1 = Initialize DAC's
  I2C_16_write_M();     //Send the command


  //Serial Output Control Register.  Address 081E
  Parameter_1_MSB = 8;  //subaddress MSB
  Parameter_1 = 0x1E;   //subaddress LSB
  Parameter_2 = 2;      //length = 2 bytes
  Cmd_Data[0] = 0x8;      //Master, with internal clock divider = 16.  BCLK = 3.072MHz
  Cmd_Data[1] = 0x0;      //default to stereo 24-bit
  I2C_16_write_M();     //Send the command

  //Multipurpose Pin Configuration Register #1.  Address 0820
  Parameter_1_MSB = 8;  //subaddress MSB
  Parameter_1 = 0x20;   //subaddress LSB
  Parameter_2 = 3;      //length
  Cmd_Data[0] = 0x44;      //MP5, MP4 = Serial data port
  Cmd_Data[1] = 0x44;      //MP3, MP2 = Serial data port
  Cmd_Data[2] = 0x44;      //MP1, MP0 = Serial data port
  I2C_16_write_M();     //Send the command

  //Multipurpose Pin Configuration Register #2.  Address 0821
  Parameter_1_MSB = 8;  //subaddress MSB
  Parameter_1 = 0x21;   //subaddress LSB
  Parameter_2 = 3;      //length
  Cmd_Data[0] = 0x44;   //MP11, MP10 = Serial data port
  Cmd_Data[1] = 0;      //MP9, MP8 = GPIO input
  Cmd_Data[2] = 0x4;    //MP7 = GPIO input; MP6 = Serial data
  I2C_16_write_M();     //Send the command
}

Unfortunately, this code was translated from 6801 assembly code that I wrote years ago, and in assembly code it is more efficient to pass parameters with global variables than to pass them as arguments for functions.  Here is the declaration of those global variables:

uint8_t   Parameter_1;
uint8_t   Parameter_1_MSB =  0x08;
uint8_t   Parameter_2;
uint8_t   Cmd_Data[16];


I havent put any license information in the code, because Im not sure what I want to do with it yet.  For now, please treat this as proprietary information that you can use freely for your own purposes, but do not share it with others.

Thanks

Neil  
